using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.IO;
using System.Text.RegularExpressions;
using GeneratorLibrary.Client.Base;

namespace MySqlGeneratorLibrary {
    public class MySqlDataClass : ClassBase {


        protected override ClassColumnBase CreateColumn(DataRow row) {
            return new MySqlClassColumn(row);
        }

        protected override string GetExtraUsingStatements() {
            return "using MySqlDAC;\nusing MySql.Data.MySqlClient;\n";
        }

        public MySqlDataClass(DataTable dt, string table, string classNamespace, string dacNamespace, string dacName)
            : base(dt, table, classNamespace, dacNamespace, dacName) {
        }

        protected override string ReadById(string table) {
            return dacName + ".ReadById<" + table + ">(this, \"" + table + "\");\n";
        }
        protected override string ReadAll(string table) {
            return "return " + dacName + ".ReadAll<" + table + ">(\"" + table + "\");\n";
        }
        protected override string ReadByParams(string table, ClassColumnBase c, string parameterVariable) {
            return "return " + dacName + ".ReadByParams<" + table + ">(\"" + table + "\", " + dacName + ".newInParam(\"@" + c.ColumnName + "\", " + parameterVariable + "));\n";
        }
    }
}
